var _ = require("lodash");
//  _.intersectionWith([arrays], [comparator])
// 这个方法类似_.intersection，区别是它接受一个 comparator 调用比较arrays中的元素。
// 结果值是从第一数组中选择。comparator 会传入两个参数：(arrVal, othVal)
//
let brr = [
  { name: "tom", age: "18" },
  { name: "tom2", age: "28" },
  { name: "tom3", age: "38" },
];
let brr2 = [
  { name: "tom4", age: "48" },
  { name: "tom2", age: "28" },
  { name: "tom5", age: "38" },
];
let brr3 = [
  { name: "tom6", age: "68" },
  { name: "tom2", age: "28" },
  { name: "tom7", age: "38" },
];

let a = _.intersectionWith(brr, brr2, brr3, _.isEqual);
// console.log(a);

function test(a, b) {
  return a.age == b.age;
}
let b = _.intersectionWith(brr, brr2, brr3, test);
console.log(b);
